package Demo02.Demo04;

import java.util.Arrays;
import java.util.Scanner;

public class Demo_interposition {
    public static void fun(int[] arr,int n){
        int count =0;
        int[] b = new int[arr.length+1];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]<n){
                b[i]=arr[i];
                count++;
            }else if (arr[i]>n){
                b[i+1]=arr[i];

            }
        }
        b[count]= n;
        System.out.println(Arrays.toString(b));
    }
    public static void main(String[] args) {
        int[] arr ={1,2,3,4,5,6,7};
        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个整数值");
        int nextInt = sc.nextInt();
        fun(arr,nextInt);
    }
}
